using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ShareTools.MainWin
{
    public partial class About : Form
    {
        public About()
        {
            InitializeComponent();

            linkLabel1.Links.Add(0, linkLabel1.Text.Length, "http://sharenotes.wordpress.com");
            linkLabel2.Links.Add(0, linkLabel2.Text.Length, "http://sharetools.codeplex.com");
            linkLabel3.Links.Add(0, linkLabel3.Text.Length, "mailto:sri@nivas.org");
        }

        private void About_Load(object sender, EventArgs e)
        {

        }

        private void btnCloseAbt_Click(object sender, EventArgs e)
        {
            this.Close();
            this.Dispose();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Determine which link was clicked within the LinkLabel.
            this.linkLabel1.Links[linkLabel1.Links.IndexOf(e.Link)].Visited = true;

            // Display the appropriate link based on the value of the 
            // LinkData property of the Link object.
            string target = e.Link.LinkData as string;
            OpenLink(target);
        }
        
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Determine which link was clicked within the LinkLabel.
            this.linkLabel2.Links[linkLabel2.Links.IndexOf(e.Link)].Visited = true;

            // Display the appropriate link based on the value of the 
            // LinkData property of the Link object.
            string target = e.Link.LinkData as string;
            OpenLink(target);
        }

        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Determine which link was clicked within the LinkLabel.
            this.linkLabel3.Links[linkLabel3.Links.IndexOf(e.Link)].Visited = true;

            // Display the appropriate link based on the value of the 
            // LinkData property of the Link object.
            string target = e.Link.LinkData as string;
            OpenLink(target);
        }

        private void OpenLink(string target)
        {
            // If the value looks like a URL, navigate to it.
            // Otherwise, display it in a message box.
            if (null != target)// && target.StartsWith("http"))
            {
                System.Diagnostics.Process.Start(target);
            }
            else
            {
                MessageBox.Show("Item clicked: " + target);
            }
        }
    }
}